package com.zb.system.controller;


import com.zb.entity.AccounLoginInfo;
import com.zb.result.PageUtil;
import com.zb.result.Result;
import com.zb.service.ZjSystemLogService;
import com.zb.system.service.ConSystemLogService;
import com.zb.utils.TokenUtil;
import com.zb.vo.SystemLogListSearchVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 系统日志表 前端控制器
 * </p>
 *
 * @author WEN
 * @since 2024-03-07
 */
@Api(tags = "系统日志类接口")
@RestController
@RequestMapping("/system/log")
public class ZjSystemLogController {
    @Resource
    private ConSystemLogService conSystemLogService;
    @Resource
    private ZjSystemLogService systemLogService;

    @ApiOperation("获取系统操作日志列表")
    @PostMapping("/getList")
    public Result getList(HttpServletRequest request, @RequestBody SystemLogListSearchVo search) {
        AccounLoginInfo loginInfo = TokenUtil.getAccountLoginInfo(request);
        return Result.success("获取系统操作日志列表成功").data(conSystemLogService.getList(loginInfo, search));
    }

    @ApiOperation("根据系统日志ID获取日志操作内容")
    @GetMapping("/getSysLogOperateContent/{id}")
    public Result getSysLogOperateContent(@PathVariable @ApiParam(value = "日志ID") Long id) {
        return Result.success("获取日志操作内容成功").data(PageUtil.row(systemLogService.getSysLogOperateContent(id)));
    }

}
